import { reqNavleft, reqBuyData, reqOrderData } from '@/api'
const actions = {
    async getNavData({ commit }) {
        let result = await reqNavleft()
        if (result.code == 200) {
            console.log(result.data);
            commit('GETNAVDATA', result.data)
        }
    },
    async getBuyData({ commit }) {
        let result = await reqBuyData()
        if (result.code == 200) {
            commit('GETBUYDATA', result.data)
        }
    },
    async getOrderData({ commit }) {
        let result = await reqOrderData()
        if (result.code == 200) {
            commit('GETORDERDATA', result.data)
        }
    }
}
const mutations = {
    GETNAVDATA(state, value) {
        state.navData = value
    },
    GETBUYDATA(state, value) {
        state.buyData = value
    },
    GETORDERDATA(state, value) {
        state.orderData = value
    }
}
const state = {
    navData: [],
    buyData: [],
    orderData: []
}
const getters = {}
export default {
    namespaced: true,
    state,
    mutations,
    actions,
    getters
}